package miao.demo.factory;

import miao.demo.dao.UserDao;
import miao.demo.dao.impl.UserDaoImpl;
import org.springframework.beans.factory.FactoryBean;

public class UserDaoFactoryBean implements FactoryBean<UserDao> {

    //代替实例化工厂种创建对象的方法，返回的是需要创建的对象
    @Override
    public UserDao getObject() throws Exception {
        return new UserDaoImpl();
    }

    //返回创建对象的类型 即字节码文件
    @Override
    public Class<?> getObjectType() {
        return UserDao.class;
    }

    //设置单例or非单例
    @Override
    public boolean isSingleton() {
        return false;
    }
}
